<div>
  <p-panel header="外包项目供方选定单" [toggleable]="true">
    <div class="row" style="overflow: auto;">
      <!--<Primeng-TurboTable-Start>-->
      <div class="primeng-datatable-container" [busyIf]="isLoading">
        <p-table #dataTable [value]="datatablevalues" rows="{{rows}}" [paginator]="false"  editMode='row' dataKey="taskForModelId" [lazy]="true"
          [scrollable]="true" ScrollWidth="100%" ScrollHeight='100%' [resizableColumns]="true">
          <ng-template pTemplate="header">
            <tr>
              <th style="width: 100px" rowspan="2"> 操作</th>
              <th style="width: 150px" rowspan="2">任务编号</th>
              <th style="width: 150px" rowspan="2">产品图号 </th>
              <th style="width: 150px" rowspan="2">产品名称</th>
              <th style="width: 150px" rowspan="2">数量 </th>
              <th style="width: 150px" rowspan="2">加工状态 </th>
              <th [ngStyle]="{'width':canvasWidth+'px'}"  [ngClass]="{'badCurly':true}" [attr.colspan]="suppliers.length">厂家报价 </th>
              <th style="width: 250px" rowspan="2">选定厂家 </th>
              <th style="width: 150px" rowspan="2">选定原因 </th>
              <th style="width: 150px" rowspan="2">备注 </th>
            </tr>
            <tr>
              <th *ngFor="let item of suppliers" style="width: 230px">
                {{item}}
              </th>
            </tr>
          </ng-template>
          <ng-template pTemplate="body" let-editing="editing"  let-record="$implicit" let-ri='rowIndex'>
            <tr  [pEditableRow]='record'>
              <td style="width: 100px">
                <button *ngIf="!editing" pButton type="button" pInitEditableRow icon="pi pi-pencil"
                    class="ui-button-info" (click)="onRowEditInit(record)"></button>
                  <button *ngIf="editing" pButton type="button" pSaveEditableRow icon="pi pi-check"
                    class="ui-button-success" style="margin-right: .5em" (click)="onRowEditSave(record)"></button>
                  <button *ngIf="editing" pButton type="button" pCancelEditableRow icon="pi pi-times"
                    class="ui-button-danger" (click)="onRowEditCancel(record, ri)"></button>
              </td>
              <td style="width: 150px">
                <span class="m--font-boldest"> {{record.taskCode}}</span>
              </td>
              <td style="width: 150px">
                <span class="m--font-boldest"> {{record.picNo}}</span>
              </td>
              <td style="width: 150px">
                <span class="m--font-boldest"> {{record.taskName}}</span>
              </td>
              <td style="width: 150px">
                <span class="m--font-boldest"> {{record.outsouringAmount}}</span>
              </td>
              <td style="width: 150px">
                <span class="m--font-boldest"> {{record.workStatus}}</span>
              </td>
              <td *ngFor="let item of suppliers; let i =index"   style="width: 230px">
                  {{getSupplierQuotation(item,ri)}}
              </td>
              <td style="width: 250px">
                <p-cellEditor>
                  <ng-template pTemplate="input">
                    <p-dropdown [options]="supplierItems" [autoDisplayFirst]='false' [(ngModel)]="record.supplierName" baseZIndex='999' name='supplierName' (onChange)='changesuppler($event,record)'></p-dropdown>
                  </ng-template>
                  <ng-template pTemplate="output">
                    {{record.supplierName}}
                  </ng-template>
                </p-cellEditor>
              </td>
              <td style="width: 150px">
                <p-cellEditor>
                  <ng-template pTemplate="input">
                    <input pInputText type="text" style='width:70px;' name='reason'
                      [(ngModel)]="record.reason" required>
                  </ng-template>
                  <ng-template pTemplate="output">
                    {{record.reason}}
                  </ng-template>
                </p-cellEditor>
              </td>
              <td style="width: 150px">
                <span class="m--font-boldest"> {{record.remark}}</span>
              </td>
            </tr>
          </ng-template>
        </p-table>
        <div class="primeng-no-data" *ngIf="rows == 0">
          {{'NoData' | localize}}
        </div>
      </div>
    </div>
  </p-panel>
  <p-footer>
    <div class="row" style="padding-left: 2%;">
      <button [disabled]="saving" type="button" class="btn btn-default" (click)="closemodel()">
        保存
      </button>
      <button type="button" (click)="audityes()" class="btn btn-primary2" [buttonBusy]="saving">
        <i class="fa fa-save"></i> <span>提交</span>
      </button>
    </div>
  </p-footer>
</div>